var Common = require('Common');
cc.Class({
    extends: cc.Component,

    properties: {
        sprAvatar: cc.Sprite,
        nodRank: cc.Node,
        sprMedal: cc.Sprite,
        labScore: cc.Label,
        labNick: cc.Label,
        labRank: cc.Label,
    },

    // onLoad () {},

    // #EF8484 红
    // #B1EA27 绿
    // #98D6E5 水蓝

    // 3bb3de 蓝
    // aac94f 绿
    // db5758 红
    // f8b43b 黄

    // 640 710
    init(idx, avatar, nick, score) {
        // 排名
        if (idx <= 3) {
            this.nodRank.active = false;
            this.labRank.node.active = false;
            this.sprMedal.node.active = true;
            let url = 'textures/Rank' + idx;
            Common.setSpriteFrame(this.sprMedal, url);
        } else {
            this.nodRank.active = true;
            this.labRank.node.active = true;
            this.sprMedal.node.active = false;
            this.labRank.string = idx;
        }

        this.labScore.string = score;
        this.labNick.string = nick;

        Common.loadAvatar(this.sprAvatar,avatar);
    },

    // update (dt) {},
});
